package com.kaifamiao.jdbc.d0908;

import com.kaifamiao.jdbc.d0908.entity.Users;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class Test02 {

    public static void main(String[] args) {
        String sql = "select * from users";

        String url = "jdbc:mysql://localhost:3306/kfm";
        try {
            Connection conn = DBHelper.getConnection(url, "root", "");
//            ResultSet set = DBHelper.query(conn, sql);
//            List<Users> users = DBHelper.mapperAll(set);

            List<Users> users = DBHelper.queryMany(conn, sql);

            users.forEach(e -> System.out.println(e));

        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
